.class Lorg/zeam/Launcher$DesktopBinder;
.super Landroid/os/Handler;
.source "Launcher.java"

# interfaces
.implements Landroid/os/MessageQueue$IdleHandler;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lorg/zeam/Launcher;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "DesktopBinder"
.end annotation


# static fields
.field static final ITEMS_COUNT:I = 0x6

.field static final MESSAGE_BIND_APPWIDGETS:I = 0x2

.field static final MESSAGE_BIND_DRAWER:I = 0x3

.field static final MESSAGE_BIND_ITEMS:I = 0x1


# instance fields
.field private final mAppWidgets:Ljava/util/LinkedList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/LinkedList",
            "<",
            "Lorg/zeam/LauncherAppWidgetInfo;",
            ">;"
        }
    .end annotation
.end field

.field private final mItemInfos:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lorg/zeam/ItemInfo;",
            ">;"
        }
    .end annotation
.end field

.field private final mLauncher:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference",
            "<",
            "Lorg/zeam/Launcher;",
            ">;"
        }
    .end annotation
.end field

.field public mTerminate:Z


# direct methods
.method constructor <init>(Lorg/zeam/Launcher;Ljava/util/ArrayList;Ljava/util/ArrayList;)V
    .locals 6
    .parameter "launcher"
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lorg/zeam/Launcher;",
            "Ljava/util/ArrayList",
            "<",
            "Lorg/zeam/ItemInfo;",
            ">;",
            "Ljava/util/ArrayList",
            "<",
            "Lorg/zeam/LauncherAppWidgetInfo;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 2476
    .local p2, itemInfos:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lorg/zeam/ItemInfo;>;"
    .local p3, appWidgets:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lorg/zeam/LauncherAppWidgetInfo;>;"
    invoke-direct {p0}, Landroid/os/Handler;-><init>()V

    .line 2474
    const/4 v4, 0x0

    iput-boolean v4, p0, Lorg/zeam/Launcher$DesktopBinder;->mTerminate:Z

    .line 2481
    new-instance v4, Ljava/lang/ref/WeakReference;

    invoke-direct {v4, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v4, p0, Lorg/zeam/Launcher$DesktopBinder;->mLauncher:Ljava/lang/ref/WeakReference;

    .line 2483
    iput-object p2, p0, Lorg/zeam/Launcher$DesktopBinder;->mItemInfos:Ljava/util/ArrayList;

    .line 2485
    iget-object v4, p0, Lorg/zeam/Launcher$DesktopBinder;->mItemInfos:Ljava/util/ArrayList;

    invoke-static {}, Lorg/zeam/ItemInfo;->createCellXComparator()Ljava/util/Comparator;

    move-result-object v5

    invoke-static {v4, v5}, Ljava/util/Collections;->sort(Ljava/util/List;Ljava/util/Comparator;)V

    .line 2487
    invoke-static {p1}, Lorg/zeam/Launcher;->access$5(Lorg/zeam/Launcher;)Lorg/zeam/Workspace;

    move-result-object v4

    invoke-virtual {v4}, Lorg/zeam/Workspace;->getCurrentScreen()I

    move-result v0

    .line 2488
    .local v0, currentScreen:I
    invoke-virtual {p3}, Ljava/util/ArrayList;->size()I

    move-result v3

    .line 2490
    .local v3, size:I
    new-instance v4, Ljava/util/LinkedList;

    invoke-direct {v4}, Ljava/util/LinkedList;-><init>()V

    iput-object v4, p0, Lorg/zeam/Launcher$DesktopBinder;->mAppWidgets:Ljava/util/LinkedList;

    .line 2492
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    if-lt v1, v3, :cond_0

    .line 2504
    return-void

    .line 2493
    :cond_0
    invoke-virtual {p3, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lorg/zeam/LauncherAppWidgetInfo;

    .line 2494
    .local v2, launcherAppWidgetInfo:Lorg/zeam/LauncherAppWidgetInfo;
    iget v4, v2, Lorg/zeam/LauncherAppWidgetInfo;->screen:I

    if-ne v4, v0, :cond_1

    .line 2495
    iget-object v4, p0, Lorg/zeam/Launcher$DesktopBinder;->mAppWidgets:Ljava/util/LinkedList;

    invoke-virtual {v4, v2}, Ljava/util/LinkedList;->addFirst(Ljava/lang/Object;)V

    .line 2492
    :goto_1
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 2497
    :cond_1
    iget-object v4, p0, Lorg/zeam/Launcher$DesktopBinder;->mAppWidgets:Ljava/util/LinkedList;

    invoke-virtual {v4, v2}, Ljava/util/LinkedList;->addLast(Ljava/lang/Object;)V

    goto :goto_1
.end method


# virtual methods
.method public handleMessage(Landroid/os/Message;)V
    .locals 4
    .parameter "msg"

    .prologue
    .line 2535
    iget-object v1, p0, Lorg/zeam/Launcher$DesktopBinder;->mLauncher:Ljava/lang/ref/WeakReference;

    invoke-virtual {v1}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/zeam/Launcher;

    .line 2536
    .local v0, launcher:Lorg/zeam/Launcher;
    if-eqz v0, :cond_0

    iget-boolean v1, p0, Lorg/zeam/Launcher$DesktopBinder;->mTerminate:Z

    if-eqz v1, :cond_1

    .line 2553
    :cond_0
    :goto_0
    return-void

    .line 2539
    :cond_1
    iget v1, p1, Landroid/os/Message;->what:I

    packed-switch v1, :pswitch_data_0

    goto :goto_0

    .line 2541
    :pswitch_0
    iget-object v1, p0, Lorg/zeam/Launcher$DesktopBinder;->mItemInfos:Ljava/util/ArrayList;

    iget v2, p1, Landroid/os/Message;->arg1:I

    iget v3, p1, Landroid/os/Message;->arg2:I

    invoke-static {v0, p0, v1, v2, v3}, Lorg/zeam/Launcher;->access$19(Lorg/zeam/Launcher;Lorg/zeam/Launcher$DesktopBinder;Ljava/util/ArrayList;II)V

    goto :goto_0

    .line 2545
    :pswitch_1
    const/4 v1, 0x0

    invoke-static {v0, p0, v1}, Lorg/zeam/Launcher;->access$20(Lorg/zeam/Launcher;Lorg/zeam/Launcher$DesktopBinder;Lorg/zeam/ApplicationsAdapter;)V

    goto :goto_0

    .line 2549
    :pswitch_2
    iget-object v1, p0, Lorg/zeam/Launcher$DesktopBinder;->mAppWidgets:Ljava/util/LinkedList;

    invoke-static {v0, p0, v1}, Lorg/zeam/Launcher;->access$21(Lorg/zeam/Launcher;Lorg/zeam/Launcher$DesktopBinder;Ljava/util/LinkedList;)V

    goto :goto_0

    .line 2539
    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_2
        :pswitch_1
    .end packed-switch
.end method

.method public queueIdle()Z
    .locals 1

    .prologue
    .line 2524
    invoke-virtual {p0}, Lorg/zeam/Launcher$DesktopBinder;->startBindingAppWidgets()V

    .line 2525
    const/4 v0, 0x0

    return v0
.end method

.method public startBindingAppWidgets()V
    .locals 1

    .prologue
    .line 2529
    const/4 v0, 0x2

    invoke-virtual {p0, v0}, Lorg/zeam/Launcher$DesktopBinder;->obtainMessage(I)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V

    .line 2530
    return-void
.end method

.method public startBindingAppWidgetsWhenIdle()V
    .locals 1

    .prologue
    .line 2519
    invoke-static {}, Landroid/os/Looper;->myQueue()Landroid/os/MessageQueue;

    move-result-object v0

    .line 2520
    .local v0, messageQueue:Landroid/os/MessageQueue;
    invoke-virtual {v0, p0}, Landroid/os/MessageQueue;->addIdleHandler(Landroid/os/MessageQueue$IdleHandler;)V

    .line 2521
    return-void
.end method

.method public startBindingDrawer()V
    .locals 1

    .prologue
    .line 2515
    const/4 v0, 0x3

    invoke-virtual {p0, v0}, Lorg/zeam/Launcher$DesktopBinder;->obtainMessage(I)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V

    .line 2516
    return-void
.end method

.method public startBindingItems()V
    .locals 3

    .prologue
    .line 2511
    const/4 v0, 0x1

    const/4 v1, 0x0

    iget-object v2, p0, Lorg/zeam/Launcher$DesktopBinder;->mItemInfos:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->size()I

    move-result v2

    invoke-virtual {p0, v0, v1, v2}, Lorg/zeam/Launcher$DesktopBinder;->obtainMessage(III)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V

    .line 2512
    return-void
.end method
